package co.srm.utilidades;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author william
 */
public class FactorySingleton {

private static FactorySingleton instance;

    private final EntityManagerFactory factory;

    private FactorySingleton() {
        this.factory = Persistence.createEntityManagerFactory("SRMPU");
    }
    public static FactorySingleton getInstance() {
        if (instance == null) createInstance();
        return instance;
    }
    private synchronized static void createInstance() {
         if (instance == null) {
            instance = new FactorySingleton();
        }
    }
    public EntityManagerFactory getEntityManagerFactory() {
        return this.factory;
    }
}
